package com.tongji.housediy.controller.goodsCMD
{
	import com.tongji.housediy.events.goodsEvent.SearchGoodsEvent;
	import com.tongji.housediy.model.SearchResultModel;
	import com.tongji.housediy.service.GoodsService;
	
	import org.robotlegs.mvcs.Command;
	
	/**
	 * 
	 * @author liaoruohuai
	 * 2011-4-8
	 */
	public class SearchGoodsCommand extends Command
	{
		[Inject]
		public var service:GoodsService;
		
		[Inject]
		public var event:SearchGoodsEvent;
		
		[Inject]
		public var model:SearchResultModel;
		
		override public function execute():void
		{
			switch(event.type)
			{
				case "searchGoods":
					service.searchGoodsByName(event.searchType, event.searchName);
					break;
				case "updateSearchResult":
					model.updateSearchResultModel(event.searchResult);
					break;
			}
		}
	}
}